package com.qiwx.pigeon.adapter.home;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.qiwx.pigeon.R;

import java.util.ArrayList;
import java.util.List;

/**
 * @description
 * @Author qiwx
 * @Date 2020-06-26 10:37
 * 配对筛选adapter
 **/
public class PdStatusAdapter extends BaseAdapter {
    List<String> data = null;
    Context context;
    LayoutInflater mListContainer;

    public PdStatusAdapter(Context context, List<String> data) {
        this.context = context;
        this.data = data;
        mListContainer = LayoutInflater.from(context);

    }

    @Override
    public int getCount() {
        return data == null ? 0 : data.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ListItemView listItemView;
        if (convertView == null) {
            listItemView = new ListItemView();
            convertView = mListContainer.inflate(R.layout.adapter_pd_status_item, null);
            listItemView.mName = (TextView) convertView.findViewById(R.id.name);
            convertView.setTag(listItemView);
        } else {
            listItemView = (ListItemView) convertView.getTag();
        }
        String name = data.get(position);
        listItemView.mName.setText(name);
        return convertView;
    }

    private class ListItemView {
        public TextView mName;
    }
}
